package com.tjsinfo.tjsoa.address.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.tjsinfo.tjsoa.address.personal.TAddresslistPersonal;
import com.tjsinfo.tjsoa.address.personal.TAddresslistPersonalDao;
import com.tjsinfo.tjsoa.address.personal.TAddresslistPersonalManager;

public class PersonalDeleteAction extends Action {
	
    TAddresslistPersonalManager addresslistPersonalManager;
    TAddresslistPersonalDao addresslistPersonalDao;
    
	public TAddresslistPersonalManager getAddresslistPersonalManager() {
		return addresslistPersonalManager;
	}

	public void setAddresslistPersonalManager(
			TAddresslistPersonalManager addresslistPersonalManager) {
		this.addresslistPersonalManager = addresslistPersonalManager;
	}
	
	public TAddresslistPersonalDao getAddresslistPersonalDao() {
		return addresslistPersonalDao;
	}

	public void setAddresslistPersonalDao(
			TAddresslistPersonalDao addresslistPersonalDao) {
		this.addresslistPersonalDao = addresslistPersonalDao;
	}

	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		try {
			String id=request.getParameter("id");
			TAddresslistPersonal ins=addresslistPersonalManager.findByID(Integer.valueOf(id));
			addresslistPersonalDao.delete(ins);	
			
			return mapping.findForward("success");
		}catch (Exception e) {
			return mapping.findForward("failure");
		}
	}
}
